import { getStore } from '../stores';
import { changeUserInfo } from '../actions/login';
import { IAllState } from '../interfaces';

const mapStateToLoginPageProps = (state: IAllState) => {
    return {
        ...state.login,
    };
};

class LoginLogic {
    private store = getStore();
    constructor() {
        this.initLogin();
    }

    public initLogin() {
        const loginStateMock = {
            userName: 'dave',
            userId: '2',
            vipMember: false,
            isMale: false,
            image: '',
        };
        this.store.dispatch(changeUserInfo(loginStateMock));
    }
}

export { LoginLogic, mapStateToLoginPageProps };
